package thread;

import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入倒计时的秒数:");
        int num = scan.nextInt();
        try {
            for (int i = num; i >= 0; --i) {
                System.out.println(i);
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
//        try {
//            Thread.sleep(5000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        System.out.println("程序结束了");
    }
}
